package com.wy.config;

import com.wy.interceptor.MyInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: wy
 * @Date:2019/10/26 21:25
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {

          @Bean
         public MyInterceptor myInterceptor(){
             return  new MyInterceptor();
         }

    public void addInterceptors(InterceptorRegistry registry) {
                registry.addInterceptor(myInterceptor()).addPathPatterns("/*");
    }
}
